package com.cskaoyan.bean.wx_resp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author liXiaoFei
 * @date 2021/10/21 14:39
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WxRespVo<T> {

    private long errno;
    private T data;
    private String errmsg;

    public static WxRespVo<?> ok(Object data) {
        return new WxRespVo<>(0, data, "成功");
    }

    public static WxRespVo<?> ok() {
        return new WxRespVo<>(0, null, "成功");
    }

    public static WxRespVo<?> error() {
        return new WxRespVo<>(500, null, "失败");
    }

    public static WxRespVo<?> error(String errorMsg) {
        return new WxRespVo<>(700, null, errorMsg);
    }
    public static WxRespVo<?> errorParam(String errorMsg) {
        return new WxRespVo<>(401, null, errorMsg);
    }
    public static WxRespVo<?> errorRegister() {
        return new WxRespVo<>(703, null, "验证码错误");
    }
    public static WxRespVo<?> errorWxLogin() {
        return new WxRespVo<>(501, null, "请先登录");
    }
}
